/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.swirrel.util;

public class Tuple<F, S> {

    private final F f;
    private final S s;

    private Tuple(F f, S s) {
        this.f = f;
        this.s = s;
    }

    public F first() {
        return f;
    }

    public S second() {
        return s;
    }

    @Override public boolean equals(Object o) {
      if (o instanceof Tuple) {
        Tuple<?,?> that = (Tuple)o;
        return this.f.equals(that.f) && this.s.equals(that.s);
      }
      return false;
    }

    @Override public int hashCode() {
      return f.hashCode() + 37*s.hashCode();
    }

    public static <A, B> Tuple<A, B> of(A a, B b){
        return new Tuple<A, B>(a,b);
    }
}
